package cn.bone.motan.demo2.web;

import cn.bone.motan.demo1.api.Hello;
import com.weibo.api.motan.config.springsupport.annotation.MotanReferer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * Created by MD-01 on 2017/3/9.
 */
@RestController
@RequestMapping("/hello")
public class HelloController {

    private Logger logger = LoggerFactory.getLogger("hello web");

    @Resource(name="remoteService")
    private Hello hello;

    @RequestMapping("/say")
    public String sayHello(String name){

        logger.info("调用/say name="+name);
        logger.info(hello.getClass().getTypeName());
        String result = hello.sayHello(name);
        return result;
    }

    @RequestMapping("/compute")
    public int compute(int a,int b){

        int result = hello.compute(a,b);
        return result;
    }
}
